var wl = require("../components/winLocation.js");
var jqselect = require("../vendors/select.js");
var stagesVue = require("./stagesVue.js");
var loadingVue = require("./loadingVue.js");
var stageVueObject,loadingVueObject;
var orderId, sign;
var stepData = {
    step:1,  //  1:
    pop:1   // 0表示不弹窗，1:表示加载loding,2表示正常提示弹框
};
$(document).ready(function() {
    // 页面加载完成
    console.log("ready-------------");
    initVaule();
    getRateInfo();
});



// 取分期信息
function getRateInfo() {
    //    orderId = decodeURI(wl.QueryString.GetValue("orderId")).replace(/\%2B/g, "+").replace(/\s+/g, "");
    orderId = wl.QueryString.GetValue("orderId");
    sign = wl.QueryString.GetValue("sign");
    var paramter = {
        "orderId": orderId,
        "sign": sign
    };
    $.post(payInstallmentInfoServlet, paramter, infocallback);
}

// 分期信息返回接口
function infocallback(infoData) {
    //    console.dir(infoData);
    infoData = JSON.parse(infoData);
//    clearInterval(autoMoveInterval);
//    clearInterval(autoTsqInterval);
    console.dir(infoData);

    if (infoData && infoData.data && infoData.data.returnUrl) {
        sessionStorage.setItem("returnUrl", infoData.data.returnUrl);
        stagesVue.setData(infoData.data);
    }

    stepData.pop = 0;
    if (infoData && infoData.code == "0000") {

    } else {
        var ErrorMsg = "未知错误";
        if (infoData.msg) {
            ErrorMsg = infoData.msg;
        }
        //        location.href = "../payInstallment/payPrompt.html?msg=" + ErrorMsg + "&simplPC=" + simplPC;
    }

}



// 初始化变量
function initVaule() {
    stageVueObject = stagesVue.createStagesVue();
    loadingVueObject = loadingVue.createLodingDialog(stepData);
}
